//
//  THGoodsCarNetManager.m
//  XM
//
//  Created by mingyue on 2017/12/20.
//  Copyright © 2017年 mingyue. All rights reserved.
//

#import "THGoodsCarNetManager.h"

@implementation THGoodsCarNetManager
+(instancetype)shareNetWorkManager
{
    static THGoodsCarNetManager * manager = nil;
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        manager = [[THGoodsCarNetManager alloc] init];
    });
    return  manager;
}

//轮播图
-(void)GT_getGoodsBannerWithShowType:(NSString *)showType type:(NSInteger)type success:(void (^)(TH_BaseResponse * res))responseSuccess failure:(void (^)(NSError *error))responseFailure{
    THBannerRequest * bannber = [[THBannerRequest alloc] initWithShowType:showType type:type];
    
    [[[DialogUtil sharedInstance] getDialog] showAnimated:YES];
    [bannber startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        TH_BaseResponse * baseResponse = [TH_BaseResponse mj_objectWithKeyValues:[request responseJSONObject]];
        if ([baseResponse.code compare:TH_LIVE_SUCCESS_CODE options:NSCaseInsensitiveSearch] == NSOrderedSame) {
            responseSuccess(request.responseJSONObject);
        }
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        responseFailure(request.error);
    }];
    
    
}
@end
